﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Media;

namespace 旅游管理员终端
{
    public partial class Navigator : Form
    {
        public string connectStr;
        
        public Navigator(string str)
        {
            InitializeComponent();
            connectStr = str;
            //BGM播放
            System.Media.SoundPlayer sp = new SoundPlayer();
            sp.SoundLocation = @"..\\..\\Resources\\BGM.wav";
            sp.PlayLooping();
        }

        private void 返回ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.Hide();
            AdminLogin adlogin = new AdminLogin();
            adlogin.ShowDialog();
            Application.Exit();
        }

        private void 退出ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Environment.Exit(0);
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            Date.Text = DateTime.Now.ToString("yyyy年MM月dd日 HH:mm:ss");
            Week.Text = DateTime.Now.ToString("星期ddd");
        }

        //电子时钟
        private void Navigator_Load(object sender, EventArgs e)
        {
            Date.Text = DateTime.Now.ToString("yyyy年MM月dd日 HH:mm:ss");
            Week.Text = DateTime.Now.ToString("星期ddd");
            timer1.Start();
        }

        private void Navigator_FormClosed(object sender, FormClosedEventArgs e)
        {
            timer1.Stop();
        }

        //查询菜单
        private void 旅游查询ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            DataOperation dataSearch = new DataOperation(connectStr);
            dataSearch.ShowDialog(this);
        }

        private void 热度可视化ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Diagram diagram = new Diagram(connectStr);
            diagram.ShowDialog(this);

        }
    }
}
